import request from '../utils/request'

// 获取员工简单列表
export function getEmployees() {
    return request({
        url: '/sys/user/simple',
        method:'get'
    })
}

// 获取员工的详细列表
export function getEmpLists(params) {
    return request({
        url: '/sys/user',
        method: 'get',
        params
    })
}

export function delEmp(id) {
    return request({
        url: `/sys/user/${id}`,
        method: 'delete',
    })
}

export function addEmp(data) {
    return request({
        url: '/sys/user',
        method: 'post',
        data
    })
}

export function importEmp(data) {
    return request({
        url: '/sys/user/batch',
        method: 'post',
        data
    })
}

export function saveEmp(data) {
    return request({
        url: `/sys/user/${data.id}`,
        method: 'put',
        data
    })
}
// 获取员工个人信息
export function getOwnInfo(id) {
    return request({
        url: `/employees/${id}/personalInfo`
    })
}
// 保存个人信息
export function saveOwnInfo(data) {
    return request({
        url: `/employees/${data.userId}/personalInfo`,
        method: 'PUT',
        data
    })
}
// 根据id获取工作信息
export function getJobInfo(id) {
    return request({
        url: `/employees/${id}/jobs`,
        method:'get'
    })
}

// 保存工作信息
export function saveJobInfo(data) {
    return request({
        url: `/employees/${data.userId}/jobs`,
        method: 'put',
        data
    })
}


// 设置员工角色
export function saveRoles(data) {
    return request({
        url: '/sys/user/assignRoles',
        method: 'put',
        data
    })
}